<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Đặng Khánh Trung
 * Date: 11/2/12
 * Time: 11:06 AM
 * To change this template use File | Settings | File Templates.
 */
//no direct access
defined('_JEXEC') or die;
$context = JRequest::getVar('context', '');

?>

<ul>
    <li>
        <a>Giới thiệu chung</a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=gioithieu') ?>">Giới thiệu tác giả</a>
            </li>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=sitemap') ?>">Bản đồ Website</a>
            </li>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=congtrinhs') ?>">Các công trình khoa học</a>
            </li>
        </ul>
    </li>
    <?php if (JFactory::getUser()->get('guest')): ?>
    <li>
        <a>Thông tin khoa học</a>
        <ul>
            <li>
                <a>Tin tức Viện KHCN</a>
            </li>
            <li>
                <a>Tin nổi bật trong ngày</a>
            </li>
        </ul>
    </li>
    <?php endif; ?>
    <?php if ($context !== '' && $context == 'quanlycanbophong' && (JFactory::getUser()->authorise('core.manage', 'com_vast') 
    || (JFactory::getUser()->authorise('vast.phong.quanlyhosocanbo') && $phonglanhdao->phongid == JRequest::getInt('phongid'))
    || (JFactory::getUser()->authorise('vast.phong.add.hosocanbo', 'com_vast')))): ?>
    <li>
        <a>Chức năng ngữ cảnh</a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=themnhanvienvaophong&layout=default&phongid=' . JRequest::getInt('phongid')); ?>">Thêm nhân viên vào phòng</a>
            </li>
        </ul>
    </li>    
    <?php endif; ?>
    <?php if ($context !== '' && $context == 'canbodonvis' && (JFactory::getUser()->authorise('core.manage', 'com_vast') 
    || (JFactory::getUser()->authorise('vast.donvi.quanlyhosocanbo') && $donvilanhdao->donviid == JRequest::getInt('donviid'))
    || (JFactory::getUser()->authorise('vast.donvi.add.hosocanbo', 'com_vast')))): ?>
    <li>
        <a>Chức năng ngữ cảnh</a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=themnhanvienvaodonvi&layout=default&donviid=' . JRequest::getInt('donviid')); ?>">Thêm nhân viên vào đơn vị</a>
            </li>
        </ul>
    </li>    
    <?php endif; ?>
    <?php if ($context !== '' && $context == 'dienbienluongcanbodonvis' && (JFactory::getUser()->authorise('core.manage', 'com_vast') 
    || (JFactory::getUser()->authorise('vast.donvi.quanlyhosocanbo') && $donvilanhdao->donviid == JRequest::getInt('donviid'))
    )): ?>
    <li>
        <a>Chức năng ngữ cảnh</a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=dienbienluongcanbodonvi&layout=default&donviid=' . JRequest::getInt('donviid')); ?>">Thêm mức lương mới cho cán bộ</a>
            </li>
        </ul>
    </li>    
    <?php endif; ?>
    <?php if ($context !== '' && $context == 'dienbienluongcanbophongs' && (JFactory::getUser()->authorise('core.manage', 'com_vast') || (JFactory::getUser()->authorise('vast.phong.quanlyhosocanbo') && $phonglanhdao->phongid == JRequest::getInt('phongid')))): ?>
    <li>
        <a>Chức năng ngữ cảnh</a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=dienbienluongcanbophong&layout=default&phongid=' . JRequest::getInt('phongid')); ?>">Thêm mức lương mới cho cán bộ</a>
            </li>
        </ul>
    </li>    
    <?php endif; ?>
    <?php if ($context !== '' && $context == 'khenthuongcanbophongs' && (JFactory::getUser()->authorise('core.manage', 'com_vast') || (JFactory::getUser()->authorise('vast.phong.quanlyhosocanbo') && $phonglanhdao->phongid == JRequest::getInt('phongid')))): ?>
    <li>
        <a>Chức năng ngữ cảnh</a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=khenthuongcanbophong&layout=default&phongid=' . JRequest::getInt('phongid')); ?>">Thêm khen thưởng cán bộ</a>
            </li>
        </ul>
    </li>    
    <?php endif; ?>
    <?php if ($context !== '' && $context == 'kiluatcanbophongs' && (JFactory::getUser()->authorise('core.manage', 'com_vast') || (JFactory::getUser()->authorise('vast.phong.quanlyhosocanbo') && $phonglanhdao->phongid == JRequest::getInt('phongid')))): ?>
    <li>
        <a>Chức năng ngữ cảnh</a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=kiluatcanbophong&layout=default&phongid=' . JRequest::getInt('phongid')); ?>">Thêm kỉ luật cán bộ</a>
            </li>
        </ul>
    </li>    
    <?php endif; ?>
    <?php if ($context !== '' && $context == 'quanlyhuongnghiencuu' && (JFactory::getUser()->authorise('core.manage', 'com_vast') || (JFactory::getUser()->authorise('vast.hosocanbo.edit')) || (JFactory::getUser()->authorise('vast.hosocanbo.edit.own', 'com_vast') && JFactory::getUser()->id == $hosocanbo->nguoidung_id))): ?>
    <li>
        <a>Chức năng ngữ cảnh</a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=huongnghiencuu&layout=default&id=' . $hosocanbo->id); ?>">Thêm hướng nghiên cứu</a>
            </li>
        </ul>
    </li>    
    <?php endif; ?>
    <?php if ($context !== '' && $context == 'quanlycongtrinh' && (JFactory::getUser()->authorise('core.manage', 'com_vast') || (JFactory::getUser()->authorise('vast.hosocanbo.edit')) || (JFactory::getUser()->authorise('vast.hosocanbo.edit.own', 'com_vast') && JFactory::getUser()->id == $hosocanbo->nguoidung_id))): ?>
    <li>
        <a>Chức năng ngữ cảnh</a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=congtrinh&layout=default&id=' . $hosocanbo->id); ?>">Thêm công trình nghiên cứu</a>
            </li>
        </ul>
    </li>    
    <?php endif; ?>
    <?php if ($context !== '' && $context == 'congtacs' && JFactory::getUser()->authorise('core.manage', 'com_vast')): ?>
    <li>
        <a>Chức năng ngữ cảnh</a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=themcongtac&layout=default'); ?>">Thêm quá trình công tác mới</a>
            </li>
        </ul>
    </li>    
    <?php endif; ?>
    <?php if ($context !== '' && $context == 'quanlyhocvi' && (JFactory::getUser()->authorise('vast.hosocanbo.edit', 'com_vast') || (JFactory::getUser()->authorise('vast.hosocanbo.edit.own', 'com_vast') && JFactory::getURI()->id == $hosocanbo->nguoidung_id))): ?>
    <li>
        <a>Chức năng ngữ cảnh</a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=themdienbienhocvi&id=' . JRequest::getInt('id')); ?>">Thêm diễn biến học vị mới</a>
            </li>
        </ul>
    </li>
    <?php endif; ?>
    <?php if ($context !== '' && $context == 'quanlyhocham' && (JFactory::getUser()->authorise('vast.hosocanbo.edit', 'com_vast') || (JFactory::getUser()->authorise('vast.hosocanbo.edit.own', 'com_vast') && JFactory::getURI()->id == $hosocanbo->nguoidung_id))): ?>
    <li>
        <a>Chức năng ngữ cảnh</a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=themdienbienhocham&id=' . JRequest::getInt('id')); ?>">Thêm diễn biến học hàm mới</a>
            </li>
        </ul>
    </li>
    <?php endif; ?>
    <?php if ($context !== '' && $context == 'quanlykhenthuong' && (JFactory::getUser()->authorise('vast.hosocanbo.edit', 'com_vast') || (JFactory::getUser()->authorise('vast.hosocanbo.edit.own', 'com_vast') && JFactory::getURI()->id == $hosocanbo->nguoidung_id))): ?>
    <li>
        <a>Chức năng ngữ cảnh</a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=khenthuong&layout=default&id=' . JRequest::getInt('id')); ?>">Thêm khen thưởng cán bộ</a>
            </li>
        </ul>
    </li>
    <?php endif; ?>
    <?php if ($context !== '' && $context == 'quanlykiluat' && (JFactory::getUser()->authorise('vast.hosocanbo.edit', 'com_vast') || (JFactory::getUser()->authorise('vast.hosocanbo.edit.own', 'com_vast') && JFactory::getURI()->id == $hosocanbo->nguoidung_id))): ?>
    <li>
        <a>Chức năng ngữ cảnh</a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=kiluat&layout=default&id=' . JRequest::getInt('id')); ?>">Thêm kỷ luật cán bộ</a>
            </li>
        </ul>
    </li>
    <?php endif; ?>
    <?php if ($context !== '' && $context == 'phongtructhuocs' && (JFactory::getUser()->authorise('vast.phong.create', 'com_vast') || (JFactory::getUser()->authorise('vast.donvi.quanlyphong', 'com_vast') && isset($hosocanbo) && $hosocanbo->lanhdao == 1 && $hosocanbo->donvi_id == JRequest::getInt('id')))): ?>
    <li>
        <a>Chức năng ngữ cảnh</a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=phongtructhuoc&layout=edit&id=' . JRequest::getInt('id')); ?>">Thêm phòng mới vào đơn vị</a>
            </li>
        </ul>
    </li>
    <?php endif; ?>
    <?php if ($context !== '' && $context == 'quanlyphong' && (JFactory::getUser()->authorise('vast.phong.create', 'com_vast') || (JFactory::getUser()->authorise('vast.phong.manage', 'com_vast')))): ?>
    <li>
        <a>Chức năng ngữ cảnh</a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=phong&layout=default'); ?>">Thêm phòng mới trong viện</a>
            </li>
        </ul>
    </li>
    <?php endif; ?>
    <?php if ($context !== '' && $context == 'quanlydonvi' && (JFactory::getUser()->authorise('vast.donvi.create', 'com_vast') || (JFactory::getUser()->authorise('vast.hosocanbo.manage', 'com_vast')))): ?>
    <li>
        <a>Chức năng ngữ cảnh</a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=donvi&layout=default'); ?>">Thêm đơn vị mới</a>
            </li>
        </ul>
    </li>
    <?php endif; ?>
    <?php if ($context !== '' && $context == 'hosocanbos' && (JFactory::getUser()->authorise('vast.hosocanbo.create', 'com_vast') || (JFactory::getUser()->authorise('vast.donvi.manage', 'com_vast')))): ?>
    <li>
        <a>Chức năng ngữ cảnh</a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=hosocanbo&layout=default'); ?>">Thêm hồ sơ cán bộ mới</a>
            </li>
        </ul>
    </li>
    <?php endif; ?>
    <?php if (!JFactory::getUser()->get('guest') && isset($hosocanbo) && $hosocanbo->lanhdao == 1 && $hosocanbo->donvi_id != 0): ?>
    <li>
        <a><?php echo $hosocanbo->tendonvi; ?></a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=chitietdonvi&id=' . $hosocanbo->donvi_id); ?>">Thông tin chi tiết đơn vị</a>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=donvi&layout=edit&id=' . $hosocanbo->donvi_id); ?>">Chỉnh sửa thông tin đơn vị</a>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&context=phongtructhuocs&view=phongtructhuocs&id=' . $hosocanbo->donvi_id); ?>">Phòng ban</a>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=canbodonvis&context=canbodonvis&donviid=' . $hosocanbo->donvi_id); ?>">Quản lý công chức thuộc đơn vị</a>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=dienbienluongcanbodonvis&context=dienbienluongcanbodonvis&donviid=' . $hosocanbo->donvi_id); ?>">Lương cán bộ</a>
            </li>
        </ul>
    </li>
    <?php endif; ?>
    <?php if (!JFactory::getUser()->get('guest') && isset($hosocanbo) && $hosocanbo->lanhdao == 1 && $hosocanbo->phong_id != 0): ?>
    <li>
        <a><?php echo $hosocanbo->tenphong; ?></a>
        <ul>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=chitietphong&id=' . $hosocanbo->phong_id); ?>">Thông tin chi tiết phòng</a>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=quanlycanbophong&context=quanlycanbophong&phongid=' . $hosocanbo->phong_id); ?>">Quản lý hồ sơ cán bộ phòng</a>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=phong&layout=edit&id=' . $hosocanbo->phong_id); ?>">Chỉnh sửa thông tin phòng</a>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&context=khenthuongcanbophongs&view=khenthuongcanbophongs&phongid=' . $hosocanbo->phong_id); ?>">Khen thưởng cán bộ</a>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&context=kiluatcanbophongs&view=kiluatcanbophongs&phongid=' . $hosocanbo->phong_id); ?>">Kỉ luật cán bộ</a>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&context=dienbienluongcanbophongs&view=dienbienluongcanbophongs&phongid=' . $hosocanbo->phong_id); ?>">Lương của cán bộ trong phòng</a>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&context=baocaophong&view=baocaophong&phongid=' . $hosocanbo->phong_id); ?>">Báo cáo phòng</a>
            </li>
        </ul>
    </li>
    <?php endif; ?>
    <?php if (!JFactory::getUser()->get('guest') 
        && (JFactory::getUser()->authorise('vast.core.manage', 'com_vast') 
        || JFactory::getUser()->authorise('vast.phong.manage', 'com_vast') 
        || JFactory::getUser()->authorise('vast.donvi.manage', 'com_vast') 
        || JFactory::getUser()->authorise('vast.hosocanbo.manage', 'com_vast'))): ?>
    <li>
        <a>Chức năng quản lý</a>
        <ul>
            <li>
                <?php if (JFactory::getUser()->authorise('core.manage', 'com_vast')): ?>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=congtacs&context=congtacs'); ?>">Quản lý công tác cán bộ</a>
                <?php endif; ?>
                <?php if (JFactory::getUser()->authorise('vast.phong.manage', 'com_vast')): ?>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=quanlyphong&context=quanlyphong'); ?>">Quản lý phòng</a>
                <?php endif; ?>
                <?php if (JFactory::getUser()->authorise('vast.donvi.manage', 'com_vast')): ?>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=quanlydonvi&context=quanlydonvi'); ?>">Quản lý đơn vị</a>
                <?php endif; ?>
                <?php if (JFactory::getUser()->authorise('vast.hosocanbo.manage', 'com_vast')): ?>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=hosocanbos&context=hosocanbos'); ?>">Quản lý hồ sơ cán bộ</a>
                <?php endif; ?>
            </li>
        </ul>
    </li>
    <?php endif; ?>
    <?php if (!JFactory::getUser()->get('guest') && (JFactory::getUser()->authorise('vast.core.admin', 'com_vast') || JFactory::getUser()->authorise('vast.vien.edit') || JFactory::getUser()->authorise('vast.baocao.manage'))): ?>
    <li>
        <a>Chức năng lãnh đạo</a>
        <ul>
            <li>
                <?php if (JFactory::getUser()->authorise('vast.vien.edit')): ?>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=vien&layout=edit&id=' . $vienInfo->id); ?>">Sửa thông tin viện</a>
                <?php endif; ?>
                <?php if (JFactory::getUser()->authorise('vast.baocao.manage')): ?>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=baocao'); ?>">Xác lập báo cáo</a>
                <?php endif; ?>
            </li>
        </ul>
    </li>
    <?php endif; ?>  
      
    <?php if (!JFactory::getUser()->get('guest') && isset($hosocanbo) && $hosocanbo != NULL): ?>
    <li>
        <a>Hồ sơ <?php echo $hosocanbo->hoten; ?></a>
        <ul>
            <?php if (JFactory::getUser()->authorise('vast.hosocanbo.edit.own', 'com_vast')): ?>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=chitietcanbo&id=' . $hosocanbo->id); ?>">Thông tin chi tiết hồ sơ</a>
            </li>
            <?php endif; ?>
            <?php if (JFactory::getUser()->authorise('vast.hosocanbo.edit.own', 'com_vast')): ?>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=hosocanbo&layout=edit&id=' . $hosocanbo->id); ?>">Sửa đổi lý lịch</a>
            </li>
            <?php endif; ?>
            <?php if (isset($hosocanbo) && $hosocanbo->nguoidung_id == JFactory::getUser()->id): ?>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_vast&view=xemdienbienluong&id=' . $hosocanbo->id); ?>">Xem diễn biến lương</a>
            </li>
            <?php endif; ?>
        </ul>
    </li>
    <?php endif; ?>
</ul>